

package com.hulk.dryad.common.constant;

/**
 * @author hulk
 * @date 2017-12-18
 */
public interface SecurityConstants {


	/**
	 * GRANT_TYPE
	 */
	String GRANT_TYPE = "grant_type";
	/**
	 * grantType刷新TOKEN
	 */
	String REFRESH_TOKEN = "refresh_token";
	/**
	 * 认证TOKEN
	 */
	String ACCESS_TOKEN = "access_token";
	/**
	 * 登录类型
	 */
	String LOGIN_TYPE = "login_type";

	/**
	 * BASIC前缀
	 */
	String BASIC_PREFIX = "Basic ";
	/**
	 * 认证TOKEN前缀
	 */
    String TOKEN_PREFIX = "Bearer ";

	/**
	 * 验证码有效期
	 */
	int CODE_TIME = 60;

	/**
	 * 验证码长度
	 */
	String CODE_SIZE = "4";

	/**
	 * ACTIVITI_USER角色
	 */
	String ROLE_ACTIVITI_USER = "ROLE_ACTIVITI_USER";
	/**
	 * ACTIVITI_ADMIN角色
	 */
	String ROLE_ACTIVITI_ADMIN = "ROLE_ACTIVITI_ADMIN";

	/**
	 * ACTIVITI_USER角色
	 */
	String ROLE_ACTIVITI = "ROLE_ACTIVITI";

	/**
	 * 角色前缀
	 */
	String ROLE = "ROLE_";

	/**
	 * 组前缀
	 */
	String GROUP = "GROUP_";

	/**
	 * 前缀
	 */
	String DRYAD_PREFIX = "dryad_";


	/**
	 * oauth 相关前缀
	 */
	String OAUTH_PREFIX = "oauth:";

	/**
	 * 授权码模式code key 前缀
	 */
	String OAUTH_CODE_PREFIX = "oauth:code:";

	/**
	 * 项目的license
	 */
	String DRYAD_LICENSE = "made by dryad";

	/**
	 * 内部
	 */
	String FROM_IN = "Y";

	/**
	 * 标志
	 */
	String FROM = "from";

	/**
	 * OAUTH URL
	 */
	String OAUTH_TOKEN_URL = "/oauth/token";

	/**
	 * 手机号登录URL
	 */
	String SMS_TOKEN_URL = "/oauth/token/sms";

	/**
	 * 社交登录URL
	 */
	String SOCIAL_TOKEN_URL = "/oauth/token/social";

	/**
	 * 自定义登录URL
	 */
	String CUSTOMIZER_TOKEN_URL = "/oauth/token/*";

	/**
	 * 微信获取OPENID
	 */
	String WX_AUTHORIZATION_CODE_URL = "https://api.weixin.qq.com/sns/oauth2/access_token"
			+ "?appid=%s&secret=%s&code=%s&grant_type=authorization_code";

	/**
	 * 微信小程序OPENID
	 */
	String MINI_APP_AUTHORIZATION_CODE_URL = "https://api.weixin.qq.com/sns/jscode2session"
			+ "?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code";


	/**
	 * {bcrypt} 加密的特征码 DaoAuthenticationProvider 进行验证
	 */
	String BCRYPT = "{bcrypt}";

	/**
	 * {noop} 加密的特征码 自己实现验证规则
	 */
	String NOOP = "{noop}";

	/**
	 * t_oauth_client_details 表的字段，不包括client_id、client_secret
	 */
	String CLIENT_FIELDS = "client_id, CONCAT('{noop}',client_secret) as client_secret, resource_ids, scope, "
			+ "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, "
			+ "refresh_token_validity, additional_information, autoapprove";

	/**
	 * JdbcClientDetailsService 查询语句
	 */
	String BASE_FIND_STATEMENT = "select " + CLIENT_FIELDS + " from t_oauth_client_details";

	/**
	 * 按条件client_id 查询
	 */
	String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where client_id = ? and archived_flag = 0 ";

	/**
	 * 资源服务器默认bean名称
	 */
	String RESOURCE_SERVER_CONFIGURER = "resourceServerConfigurerAdapter";

	/**
	 * 客户端模式
	 */
	String CLIENT_CREDENTIALS = "client_credentials";

	/**
	 * 用户ID字段
	 */
	String DETAILS_USER_ID = "id";

	/**
	 * 用户名
	 */
	String DETAILS_OPERATORNO = "operatorNo";

	/**
	 * 用户名
	 */
	String DETAILS_USERNAME = "username";

	/**
	 * 用户基本信息
	 */
	String DETAILS_USER = "user_info";

	/**
	 * 昵称
	 */
	String DETAILS_NICKNAME = "nickName";

	/**
	 * 头像
	 */
	String DETAILS_AVATAR = "avatar";

	/**
	 * 用户部门字段
	 */
	String DETAILS_DEPT_ID = "deptId";

	/**
	 * 租户ID 字段
	 */
	String DETAILS_TENANT_ID = "tenantId";

	/**
	 * 协议字段
	 */
	String DETAILS_LICENSE = "license";

	/**
	 * 激活字段 兼容外围系统接入
	 */
	String ACTIVE = "active";

	/**
	 * AES 加密
	 */
	String AES = "aes";
	/**
	 * 签名key
	 */
	String SIGN_KEY = "dryadM5tgb&UJhlk";



}
